package io.renren.modules.substation.service.impl;

import io.renren.modules.substation.entity.TBaseDictInfoEntity;
import io.renren.modules.substation.entity.TBusiDevStatusShowInfo;
import io.renren.modules.substation.entity.TInfoAreaInfoEntity;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.substation.dao.TBusiDevMonitorInfoDao;
import io.renren.modules.substation.entity.TBusiDevMonitorInfoEntity;
import io.renren.modules.substation.service.TBusiDevMonitorInfoService;


@Service("tBusiDevMonitorInfoService")
public class TBusiDevMonitorInfoServiceImpl extends ServiceImpl<TBusiDevMonitorInfoDao, TBusiDevMonitorInfoEntity> implements TBusiDevMonitorInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TBusiDevMonitorInfoEntity> page = this.page(
                new Query<TBusiDevMonitorInfoEntity>().getPage(params),
                new QueryWrapper<TBusiDevMonitorInfoEntity>()
        );

        return new PageUtils(page);
    }
    @Override
    public List<TBusiDevMonitorInfoEntity> queryMonitorByCondition(TBusiDevMonitorInfoEntity tBusiDevMonitorInfoEntity)
    {
        return (List<TBusiDevMonitorInfoEntity>) baseMapper.queryMonitorByCondition(tBusiDevMonitorInfoEntity);
    }

    @Override
    public int countAllMeasureBySta(Map<String, Object> param) {
        return baseMapper.countAllMeasureBySta(param);
    }

    @Override
    public int countNormalMeasureBySta(Map<String, Object> param) {
        return baseMapper.countNormalMeasureBySta(param);
    }

    @Override
    public List<TBusiDevMonitorInfoEntity> getDevDataByDev(Map<String, Object> param) {
        String devCode = (String)param.get("devCode");
        List<TBusiDevMonitorInfoEntity> list = baseMapper.selectList(
                new QueryWrapper<TBusiDevMonitorInfoEntity>()
                        .eq(devCode != null,"DEV_CODE", devCode)
        );
        return list;
    }

    @Override
    public int updateMonitorByCode (TBusiDevMonitorInfoEntity tBusiDevMonitorInfoEntity)
    {
        return baseMapper.updateMonitorByCode(tBusiDevMonitorInfoEntity);
    }

    @Override
    public int updateMonitorByCodeKindDesc (TBusiDevMonitorInfoEntity tBusiDevMonitorInfoEntity)
    {
        return baseMapper.updateMonitorByCodeKindDesc(tBusiDevMonitorInfoEntity);
    }

    @Override
    public int countAllMeasureByArea(String subAreaStr) {
        Map<String, Object> params = new HashMap<>();
        params.put("subAreaStr", subAreaStr);
        return baseMapper.countAllMeasureByArea(params);
    }

    @Override
    public int countNormalMeasureByArea(String subAreaStr) {
        Map<String, Object> params = new HashMap<>();
        params.put("subAreaStr", subAreaStr);
        return baseMapper.countNormalMeasureByArea(params);
    }

    @Override
    public List<TBusiDevMonitorInfoEntity> countAllMeasureGroup() {
        return baseMapper.countAllMeasureGroup();
    }

    @Override
    public List<TBusiDevMonitorInfoEntity> countNormalMeasureGroup() {
        return baseMapper.countNormalMeasureGroup();
    }
}